<template>
	<view class="person">
		<view class="search-bar">
			<button type="default" @tap="handleSelect">确定</button>
		</view>
		<view class="search-content">
			<uni-data-checkbox mode="list" icon="right"  :localdata="listData" multiple @change="handleChange"></uni-data-checkbox>
		</view>
	</view>


</template>

<script>
	export default {
		data() {
			return {
				listData: [],
				personData:[]
			}
		},
		methods: {
			handleSelect() {
				if(!this.personData.length){
					uni.showToast({
						title:'请选择跟进人',
						icon:'none'
					})
					return;
				}
				uni.$emit("person",{data: this.personData});
				uni.navigateBack({
					
				})
			},
			handleChange(e){
				this.personData = e.detail.data
			},
			async getPersonData(){
				console.log('getPersonData11')
				uni.showLoading({
					
				})
				const res = await this.$req({
					url: `bus/projmanage/filter.do`,
					data: {
						moduleId: 'busProjManage'
					}
				})
				uni.hideLoading()
				if (res.data.success) {
					console.log('in success')
					const personList = res.data.attributes.zdyDataSource.personDataSourceManage ?
						res.data.attributes.zdyDataSource.personDataSourceManage : [];
					this.listData = personList;
					const arr = []
					personList.forEach(item=>{
						arr.push({
							value:item.CODE,
							text:item.CODE_NAME
						})
					})
					this.listData = arr
				}
			},
		},
		onLoad() {
			this.getPersonData()
			
			
		}
	}
</script>

<style lang="scss" scoped>
	.person{
		position: fixed;
		top: 0;
		left: 0;
		z-index: 999;
		width: 100vw;
		height: 100vh;
		background-color: #FFFFFF;
	}
	.search-bar {
		background: #FFFFFF;
		width: 100%;
		padding: 6rpx 20rpx;
		border-bottom: 10rpx solid rgba(232, 240, 242, 1);
		display: flex;
	}

	.search-content {
		background: #fff;
		padding: 30rpx 0 30rpx 0;
	}
</style>
